// stores/aiMessageStore.js
import { defineStore } from "pinia";
import { ref } from "vue";

interface Message {
  id: number;
  role: string;
  content: string;
}

export const useAiChatStore = defineStore("aiChat", () => {
  const messages = ref<Message[]>([]);

  const addMessage = (Message: string, role: string) => {
    const newMessage: Message = {
      id: messages.value.length + 1,
      role: role,
      content: Message,
    };

    messages.value.push(newMessage);
  };

  return {
    messages,
    addMessage,
  };
});
